home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 24 / AMIGAplus Sonderheft 24 (2000)(Falke)(DE)[!].iso / PublicDomain / Anwendungen / MCControl / Modules / RamCard_mcm.asm < prev    next >
Assembly Source File  |  2000-01-01  |  5KB  |  138 lines

  1. ;----------------------------------------------------------------------------
  2. ;    RamCard.mcm by Guido Mersmann
  3. ;----------------------------------------------------------------------------
  4. ; This is an example code! I didn´t made any optimizations to make the
  5. ; code easy to understand! So don´t blame me!
  6. ;----------------------------------------------------------------------------
  7.     include "Include.i"
  8.     ;include "SRC.MC_ModuleInclude"
  9.     output Sourcecodes:MCControl/Modules/RamCard.mcm
  10.     opt o+,w-
  11. ;----------------------------------------------------------------------------
  12. Version = 1
  13. Revision = 12
  14. Day = 19
  15. Month = 2
  16. Year = 00
  17. ;----------------------------------------------------------------------------
  18. ;--- Macros
  19. Version_String    MACRO
  20.     dc.b "$VER: ",\1,' \<Version>.\<Revision>'," (\<Day>.\<Month>.\<Year>) ",'\2',0
  21.     ENDM
  22. ;----------------------------------------------------------------------------
  23. ;--- Your defines
  24. ;----------------------------------------------------------------------------
  25. Card_Frame_SIZEOF    = 128
  26. ;----------------------------------------------------------------------------
  27.     RSSET Module_SIZEOF
  28. ;--- User Data
  29. Module_UserData    rs.b 0
  30. ;--- Insert Userdata here!
  31. Module_CurrentPage    rs.l 1
  32. Module_UserData_End    rs.b 0
  33. ;----------------------------------------------------------------------------
  34. ;----------------------------------------------------------------------------
  35. DModule_Code    rts
  36. DModule_Version    dc.w Module_VersionNumber
  37. DModule_ID    dc.l Module_Identifier
  38. DModule_Flags    dc.l ModuleF_AccessDirectFrame|ModuleF_AccessDirectPage|ModuleF_EnableMultiPage|ModuleF_EnableModuleInfo
  39. DModule_Exec_Base    dc.l 0 ;Filled by MCControl
  40. DModule_Dos_Base    dc.l 0 ;Filled by MCControl
  41. DModule_Intuition_Base    dc.l 0 ;Filled by MCControl
  42. ;--- Card Data
  43.     ds.l 14 ;Reserved
  44. ;--- Jump Table
  45. DModule_Delay    bra DModule_Info
  46.     nop
  47.     bra DModule_Open
  48.     nop
  49.     bra DModule_Close
  50.     nop
  51.     ds.w 3*7 ;Reserved
  52.     bra DModule_AccessDirectFrame
  53.     nop
  54.     bra DModule_AccessDirectPage
  55.     nop
  56.     bra DModule_AccessRawFrame
  57.     nop
  58.     bra DModule_AccessRawPage
  59.     nop
  60.     ds.w 3*6 ;Reserved
  61.     ds.b Module_UserData_End-Module_UserData
  62. ;----------------------------------------------------------------------------
  63. Module_VersionString    Version_String "RamCard.mcm",<by Guido Mersmann>
  64.     even
  65. ;----------------------------------------------------------------------------
  66. DModule_Open    lea    RAMCARD_Page1,a0
  67.     move.l    a0,Module_CurrentPage(a4)
  68. DModule_Close
  69. DModule_AccessRawFrame
  70. DModule_AccessRawPage    moveq    #Module_Error_NoError,d0
  71.     rts
  72. ;----------------------------------------------------------------------------
  73. ;----------------------------------------------------------------------------
  74. ;    DModule_Info
  75. ;    >a0.l Pointer on Destination
  76. ;    >d0.l Pointer on Lenght
  77. ;----------------------------------------------------------------------------
  78. ;----------------------------------------------------------------------------
  79. DModule_Info    lea    Module_VersionString+6(pc),a1
  80. .Copy_Version    move.b    (a1)+,d0
  81.     move.b    d0,(a0)+
  82.     cmp.b    #"(",d0
  83.     bne    .Copy_Version
  84.     subq.w    #2,a0
  85.     clr.b    (a0)
  86.     moveq    #Module_Error_NoError,d0
  87.     rts
  88. ;----------------------------------------------------------------------------
  89. ;----------------------------------------------------------------------------
  90. ;    DModule_DirectFrame
  91. ;    >a0.l Pointer on Buffer
  92. ;    >d0.w Number of Frame
  93. ;    <d0.l NULL = OK, -1 = Error
  94. ;----------------------------------------------------------------------------
  95. ;----------------------------------------------------------------------------
  96. DModule_AccessDirectFrame
  97.     ext.l    d0
  98.     subq.l    #Module_AccessDirect_Write,d1
  99.     beq    Card_WriteFrame
  100. ;----------------------------------------------------------------------------
  101. Card_ReadFrame    move.l    Module_CurrentPage(a4),a1
  102.     mulu    #Card_Frame_SIZEOF,d0
  103.     add.l    d0,a1
  104.     moveq    #Card_Frame_SIZEOF-1,d0
  105. .Loop    move.b    (a1)+,(a0)+
  106.     dbra    d0,.Loop
  107.     moveq    #Module_Error_NoError,d0
  108.     rts
  109. ;----------------------------------------------------------------------------
  110. Card_WriteFrame    move.l    Module_CurrentPage(a4),a1
  111.     mulu    #Card_Frame_SIZEOF,d0
  112.     add.l    d0,a1
  113.     moveq    #Card_Frame_SIZEOF-1,d0
  114. .Loop    move.b    (a0)+,(a1)+
  115.     dbra    d0,.Loop
  116.     moveq    #Module_Error_NoError,d0
  117.     rts
  118. ;----------------------------------------------------------------------------
  119. ;    DModule_DirectPage
  120. ;    >d0.w Number
  121. ;    >d1.l Mode
  122. ; We only have two pages, so there is no need to check d1 for Next or Prev
  123. ; Page!!
  124. ;----------------------------------------------------------------------------
  125. DModule_AccessDirectPage
  126.     lea    RAMCARD_Page1,a0
  127.     lea    RAMCARD_Page2,a1
  128.     cmp.l    Module_CurrentPage(a4),a1
  129.     beq    .UseA0
  130.     move.l    a1,a0
  131. .UseA0    move.l    a0,Module_CurrentPage(a4)
  132.     moveq    #Module_Error_NoError,d0
  133.     rts
  134. ;----------------------------------------------------------------------------
  135.     Section "RamCard",BSS
  136. RAMCARD_Page1    ds.b 2*65536
  137. RAMCARD_Page2    ds.b 2*65536
  138.